package com.leyou.item.mapper;

import com.leyou.item.entity.Brand;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface BrandMapper extends Mapper<Brand>, SelectByIdListMapper<Brand,Long> {
    int insertCategoryAndBrand(@Param("bid") Long bid,@Param("ids") List<Long> ids);

    void updateCategoryAndBrand(@Param("bid") Long bid,@Param("cid") Long cid);

    void deleteCategoryAndBrandById(@Param("id") Long id);
@Select("select tb.id,tb.name from tb_brand tb left join tb_category_brand tcb on tb.id = tcb.brand_id where tcb.category_id =#{id}")
    List<Brand> queryBrandByCategoryId(@Param("id") Long id);
}
